<?php

namespace App\Console\Commands;

use App\Customer;
use App\Lead;
use App\Notifications\JpushNotification;
use App\User;
use Illuminate\Console\Command;

class Hello extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'hello';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $array=[];

        for ($i=1;$i<=20;$i++){
            $user_id=  \App\Customer::fenpei([18,20,17]);
            if (isset($array[$user_id])){
                $array[$user_id]=   $array[$user_id]+1;
            }else{
                $array[$user_id]=1;
            }
            $this->info('userid'.$user_id.'次数'.$array[$user_id]);
        }

        $this->info(json_encode($array));
/*       Lead::chunk(100,function($leads){
            foreach ($leads as $item){
                if ($item->customer_id!=0){
                  $customer=  Customer::find($item->customer_id);
                  if ($customer){
                      $customer->create_user_id=$item->create_user_id;
                      $customer->save();
                      $this->info($customer->customer_id);
                  }
                }
            }
        });*/


    }
}
